import asyncio

backgroud_tasks = set()

async def some_core(param):
    print("Start sleep")
    await asyncio.sleep(param)
    print("End sleep")

# for i in range(10):
#     task =asyncio.create_task(some_core(i))
#     backgroud_tasks.add(task)
#     task.add_done_callback(backgroud_tasks.discard)


async def main():
    async with asyncio.TaskGroup() as tg:
        task1 = tg.create_task(some_core(1))
        task2 = tg.create_task(some_core(1))
    print(f"Both tasks have completed now: {task1.result()}, {task2.result()}")

if __name__ == '__main__':
    asyncio.run(main())